<!DOCTYPE html>
<html >

<head>
<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>后台管理</title>
<link rel="stylesheet"
	href="${request.contextPath}${staticPath}/admin/plugins/bootstrap/css/bootstrap.min.css">
	
	<script src="${request.contextPath}${staticPath}/admin/menujs/jquery-3.3.1.min.js"></script>
<script
	src="${request.contextPath}${staticPath}/admin/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--引入ckeditor-->
<script type="text/javascript"
	src="${request.contextPath}/admin/ckeditor/ckeditor.js"></script>
<style type="text/css">
#basicSelect{
width: 300px;
height: 30px;
}
</style>
</head>

<body>
<div class="container">

	<h2>添加</h2>     
	 
	<form  action="/admin/article/articleAdd" method="post">
	<div class="form-group">

        <select id="basicSelect" name="sort">
	        <#list sort as menu>
	            <option onclick="findSelected(this)" value="${menu.id}">${menu.name}</option>
	        </#list>
        </select>
        <input type="hidden" name="sortName" id="sortName" value="">
        
    </div>

	
	  <div class="form-group">
	    <label for="title">文章标题</label>
	    <input type="text" class="form-control" name="title" id="title" placeholder="请输入文章标题">
	  </div>
		<textarea name="content" id="content"></textarea>
		<input type="submit" class="btn btn-default" value="提交" />
	</form>
</div>

<script>

	$(document).ready(function(){
    	CKEDITOR.replace('content');
    	var basicSelect=document.getElementById("basicSelect");
   		var sortName=document.getElementById("sortName");
   		sortName.value=basicSelect.options[0].text;
    	console.log(sortName.value);
	});
	function findSelected(e){
		$("#sortName").val(e.text)
	
	}
	
</script>

</body>

</html>
